---@class components
---@field webbert_life component_webbert_life

-- local function on_val(self, value)
    -- self.inst.replica.webbert_life:SetVal(value)
-- end

---@class component_webbert_life
---@field inst ent
---@field time_stamp number
local webbert_life = Class(

---@param self component_webbert_life
---@param inst ent
function(self, inst)
    self.inst = inst
    self.time_stamp = 0
end,
nil,
{
    time_stamp = function (self, value)
        self.inst.replica.webbert_life.time_stamp:set(value)
    end
})

function webbert_life:OnSave()
    return {
        time_stamp = self.time_stamp,
    }
end

function webbert_life:OnLoad(data)
    self.time_stamp = data.time_stamp or 0
end

---确保时间戳存在
function webbert_life:MakeSureTimeStamp()
    if self.time_stamp <= 0 then
        self.time_stamp = os.time()
    end
end

return webbert_life